package com.boot.security.server.dao.record;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.record.TswLogSms;

@Mapper
public interface TswLogSmsDao {

    @Select("select * from tsw_log_sms t where t.id = #{id}")
    TswLogSms getById(Long id);

    @Delete("delete from tsw_log_sms where id = #{id}")
    int delete(Long id);

    int update(TswLogSms tswLogSms);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_log_sms(sms_type, user_id, sms_content, sms_phone, sms_return, sms_code, sms_interface, sms_ip, create_time, sms_note, sms_remark) values(#{smsType}, #{userId}, #{smsContent}, #{smsPhone}, #{smsReturn}, #{smsCode}, #{smsInterface}, #{smsIp}, #{createTime}, #{smsNote}, #{smsRemark})")
    int save(TswLogSms tswLogSms);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswLogSms> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
